//
//  ViewController.m
//  test&
//
//  Created by Sizhu Ba on 2017/9/5.
//  Copyright © 2017年 Sizhu Ba. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
   // NSMutableStringS
    NSError *error = nil;
//    BOOL success = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"path" error:&error];
//    if (!success) {
//        NSLog(@"%@", [error localizedDescription]);
//    }
    
    [self getStr:&error];
  
    
       NSLog(@"下面%@", error);
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)getStr:(NSError **)error {
    NSDictionary *userInfo1 = [NSDictionary dictionaryWithObjectsAndKeys:@"由于文件不存在，无法打开", NSLocalizedDescriptionKey, @"失败原因：文件不存在", NSLocalizedFailureReasonErrorKey, @"恢复建议：请创建该文件",NSLocalizedRecoverySuggestionErrorKey,nil];
   // NSError *error2 =
    *error = [[NSError alloc] initWithDomain:NSCocoaErrorDomain code:4 userInfo:userInfo1];//此处code是4，对照下面对照表4代表文件不存在。userinfo传userinfo1 查看自定义打印。userinfo传nil，查看本地化描述。
   
}

@end
